package com.alib.myribbonrule;


import com.netflix.loadbalancer.IRule;
import com.netflix.loadbalancer.RandomRule;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

// 替换Ribbon内置的负载均衡的算法的时候，一定要写在@ComponentScan扫描不到的包
@Configuration
public class ReplaceRibbonRule {
    @Bean
    public IRule replaceRule(){
        return new RandomRule(); // 随机算法
    }
}
